package com.funfitnessapp;

import java.util.ArrayList;
import com.funfitnessapp.Profile;


public class Trophies 
{
        
        private ArrayList<Trophy> trophies;
        
        public Trophies()
        {
                trophies.add(new Marathon("Marathon Runner","Run 26 miles"));
                //trophies.add(new WeightLoss("Getting Skinny","Lose 2% of your starting weight"));
                //trophies.add(new WeightLoss2("Skin and Bones","Lose 5% of your starting weight"));
                //trophies.add(new Goal("Good Start","Achieve 1 of your set goals"));
                //trophies.add(new Goal2("Goal Crusher","Achieve 20 of your set goals"));
                //trophies.add(new Workout("Gotta Start Somewhere","Complete 1 workout"));
                //trophies.add(new Workout2("Getting it Done","Complete 20 workouts"));
                //trophies.add(new Workout3("Future Olympian","Complete 100 workouts"));
                //trophies.add(new Pedometer("Daily Dose","Walk 10000 steps in one day"));
                //trophies.add(new Pedometer2("Who Needs a Car","Walk 500000 steps"));
                trophies.add(new Distance("Morning Jog","Run 1 mile"));
                trophies.add(new Distance2("Track Star","Run 100 miles"));
        }
        public void completion(ProfilePerson x)
        {
                for(Trophy t:trophies)
                {
                        t.check(x);
                }
        }
}

abstract class Trophy
{
        String title;
        String description;
        boolean completed=false;
        public Trophy(String name,String about)
        {
                title=name;
                description=about;
        }
        public boolean isCompleted()
        {
                return completed;
        }
        public String getTitle()
        {
                return title;
        }
        public String getDescription()
        {
                return description;
        }
        public abstract boolean check(ProfilePerson person);
        
}
class Marathon extends Trophy
{
        public Marathon(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                if (person.getMilesRan()>=26)
                {
                	completed=true;
                	return true;
                }
                else
                	return false;
        }
        
}
class WeightLoss extends Trophy
{
        public WeightLoss(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                //if lost more than 5% completed=true return true else return false
                return false;
        }
}
class WeightLoss2 extends Trophy
{
        public WeightLoss2(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                //if lost more than 10 pounds completed=true return true else return false
                return false;
        }
}
class Goal extends Trophy
{
        public Goal(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                //if completed goals>1 
                return false;
        }
}
class Goal2 extends Trophy
{
        public Goal2(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                //if completed goals >20 completed=true return true else return false
                return false;
        }
}
class Workout extends Trophy
{
        public Workout(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                //if completed 1 workout completed=true return true else return false
                return false;
        }
}
class Workout2 extends Trophy
{
        public Workout2(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                //if completed 20 workouts completed=true return true else return false
                return false;
        }
}
class Workout3 extends Trophy
{
        public Workout3(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                //if completed 100 workouts completed=true return true else return false
                return false;
        }
}
class Pedometer extends Trophy
{
        public Pedometer(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                //if walked 10000 steps completed=true return true else return false
                return false;
        }
}
class Pedometer2 extends Trophy
{
        public Pedometer2(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                //if walked more than 500000 steps completed=true return true else return false
                return false;
        }
}
class Distance extends Trophy
{
        public Distance(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                if(person.getMilesRan()>=1)
                {
                	completed=true;
                	return true;
                }
                return false;
        }
}
class Distance2 extends Trophy
{
        public Distance2(String name,String about)
        {
                super(name,about);
        }
        public boolean check(ProfilePerson person)
        {
                if(completed)
                        return completed;
                if(person.getMilesRan()>=100)
                {
                	completed=true;
                	return true;
                }
                else
                	return false;
        }
}